import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;

class Solution506 {
    public String[] findRelativeRanks(int[] score) {
        PriorityQueue<Integer> priorityQueue;
        priorityQueue = new PriorityQueue<>((o1, o2)->{
            return o2-o1;
        });
        Map<Integer,Integer> map = new HashMap<>() ;
        String[] arr = new String[score.length];
        for(int i : score){
            priorityQueue.add(i) ; 
        }
        for(int i=1 ; !priorityQueue.isEmpty() ; i ++){
            map.put(priorityQueue.poll() , i);
        }
        for(int i= 0 ; i < arr.length ; i ++){
            int num = map.get(score[i]);
            if(num == 1){
             arr[i] = "Gold Medal";
            }else if(num == 2){
             arr[i] = "Silver Medal";
            }else if (num ==  3){
             arr[i] = "Bronze Medal";
            }else{
              arr[i] = ""+num ; 
            }
        }


        return arr ; 
    }
}